package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.utils.sql.SqlUtil;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.bo.LogiDriverCanScheduleQueryBo;
import com.piggy.logi.sys.domain.LogiCarrierDriver;
import com.piggy.logi.sys.vo.LogiCarrierDriverExtVo;

import java.util.List;

/**
 * 承运商司机信息Mapper接口
 *
 * @author zito
 * @date 2023-08-12
 */
public interface LogiCarrierDriverMapper extends BaseMapperPlus<LogiCarrierDriver> {

    default LogiCarrierDriver selectByPhone(Long mainDeptId, String phone) {
        return selectOne(Wrappers.<LogiCarrierDriver>lambdaQuery().eq(LogiCarrierDriver::getPhoneNumber, phone)
                .apply(SqlUtil.getDataPermissionSql(mainDeptId))
                .last("limit 1"));
                //.eq(LogiCarrierDriver::getDeptId, deptId).last("limit 1"));
    }

    List<LogiCarrierDriverExtVo> canScheduleList(LogiDriverCanScheduleQueryBo bo);

}
